
abstract class ArticleItem {
  int get type;
}

class TextArticleItem implements ArticleItem{

  String? _id;
  String? _title;
  String? _url;
  String? _source;
  int? _count;

  TextArticleItem.fromJson(Map<String, dynamic> json) {
    _id = json['id'];
    _title = json['title'];
    _url = json['url'];
    _source = json['source'];
    _count = json['count'];
  }

  String get id => _id??"";
  String get title => _title??"";
  String get url => _url??"";
  String get source => _source??"";
  int get count => _count??0;

  @override
  int get type => 1;

}

class ImageArticleItem implements ArticleItem{

  String? _id;
  String? _title;
  String? _url;
  String? _source;
  int? _count;
  String? _date;
  String? _img;

  ImageArticleItem.fromJson(Map<String, dynamic> json) {
    _id = json['id'];
    _title = json['title'];
    _url = json['url'];
    _source = json['source'];
    _count = json['count'];
    _date = json['date'];
    _img = json['img'];
  }

  String get id => _id??"";
  String get title => _title??"";
  String get url => _url??"";
  String get source => _source??"";
  int get count => _count??0;
  String get date => _date??"";
  String get img => _img??"";

  @override
  int get type => 2;

}

class MultipleImageArticleItem implements ArticleItem{

  String? _id;
  String? _title;
  String? _url;
  String? _source;
  int? _count;
  String? _date;
  List<String>? _imgs;

  MultipleImageArticleItem.fromJson(Map<String, dynamic> json) {
    _id = json['id'];
    _title = json['title'];
    _url = json['url'];
    _source = json['source'];
    _count = json['count'];
    _date = json['date'];
    _imgs = json['imgs'].cast<String>();
  }

  String get id => _id??"";
  String get title => _title??"";
  String get url => _url??"";
  String get source => _source??"";
  int get count => _count??0;
  String get date => _date??"";
  List<String> get imgs => _imgs??[];

  @override
  int get type => 3;

}